#include <iostream>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

class Solution {
public:
    /**
     * longest common substring
     * @param str1 string字符串 the string
     * @param str2 string字符串 the string
     * @return string字符串
     */
    string LCS(string str1, string str2) {
        // write code here
        int len1=str1.size(),len2=str2.size();
        if(len1==0||len2==0){
            return "";
        }
        int m=-1,x=0;
        vector<vector<int>> dp(len1+5,vector<int>(len2+5,0));
        for(int i=1;i<=len1;i++){
            for(int j=1;j<=len2;j++){
                if(str1[i-1]==str2[j-1]){
                    dp[i][j]=dp[i-1][j-1]+1;
                    if(m<dp[i][j]){
                        m=dp[i][j];
                        x=i;
                    }
                }
            }
        }
        cout << x <<endl;
        if(-1==m){
            return "";
        }
        int index=x-m+1;
        cout << index <<endl;
        return str1.substr(index,m);
    }
};
int main(){
    Solution s;

    cout << s.LCS("1AB2345CD","12345EF")<<endl;


    return 0;
}